function _IsInteger(str) { 
    if (typeof(str)=='undefined') {
        return false;
    } var expr = /^[+-]?[0-9]*$/; if (!expr.test(str)) return false; return true;
}

function _IsNumber(str) { 
    if (typeof(str)=='undefined') {
        return false;
    } var expr1 = /^[+-]?[0-9]+(.[0-9]{0,})?$/; var expr2 = /^[+-]?(.[0-9]{0,})?$/; if (!expr1.test(str)){
        if (!expr2.test(str)){
            return false;
        }
    } return true;
}

function _IsMoney(str) { 
    if (typeof(str)=='undefined') {
        return false;
    } var expr1 = /(?!^0*$)(?!^0*.0*$)^d{1,10}(.d{1,2})?$/; if (!expr1.test(str)){
        return false;
    } return true;
}

function _ValInMinMax(value,min,max) { 
    if (!(_IsNumber(value))) {
        return false;
    } if ((!(_IsNumber(min))) || (!(_IsNumber(max)))) {
        return false;
    } if ((typeof(min)!='undefined') || (typeof(max)!='undefined')) {
        if ((typeof(min)!='undefined') && (typeof(max)!='undefined')) {
            if ((!isNaN(min)) && (!isNaN(max))) if (min>max) return false;
        } else {
            if (typeof(min)!='undefined') {
                if (!isNaN(min)) if (valuemax) return false;
            }
        }
    } return true;
}

function _IsDate(date, mask, schar){ 
    if (typeof(date)=='undefined'){
        return false;
    } if (typeof(mask)=='undefined'){
        mask = "ddmmyyyy";
    } else {
        mask = mask.toLowerCase();
    } if (typeof(schar)=='undefined'){
        mask = '/';
    } if ((!(_IsInteger(date.split(schar)[0]))) || (!(_IsInteger(date.split(schar)[1]))) || (!(_IsInteger(date.split(schar)[2])))){
        return false;
    } var day, month, year; switch (mask){
        case "ddmmyyyy": day = date.split(schar)[0]; month = date.split(schar)[1]; year = date.split(schar)[2]; break; case "mmddyyyy": day = date.split(schar)[1]; month = date.split(schar)[0]; year = date.split(schar)[2]; break; case "yyyyddmm": day = date.split(schar)[2]; month = date.split(schar)[0]; year = date.split(schar)[1]; break; default : return false;
    } if (!(_ValInMinMax(year,1900,2050))){
        return false;
    } if (!(_ValInMinMax(month,1,12))){
        return false;
    } if ((month==4) || (month==6) || (month==9) || (month==11)){
        if (!(_ValInMinMax(day,1,30))){
            return false;
        }
    } if ((month==1) || (month==3) || (month==5) || (month==7) || (month==8) || (month==10) || (month==12)){
        if (!(_ValInMinMax(day,1,31))){
            return false;
        }
    } if (month==2){
        if (!(new Date(year,1,29).getDate()==29)){
            if (!(_ValInMinMax(day,1,28))){
                return false;
            }
        } else {
            if (!(_ValInMinMax(day,1,29))){
                return false;
            }
        }
    } return true;
}

function _ValDateInMinMax(date, dmax, dmin, mask, schar){ 
    if ((typeof(date)=='undefined') || (typeof(dmin)=='undefined') || (typeof(dmax)=='undefined')){
        return false;
    } if ((!(_IsDate(date,mask,schar))) || (!(_IsDate(dmin,mask,schar)) || (!(_IsDate(dmax,mask,schar))))){
        return false;
    } var day, month, year, minday, minmonth, minyear,maxday, maxmonth, maxyear; switch (mask){
        case "ddmmyyyy": day = date.split(schar)[0]; month = date.split(schar)[1]; year = date.split(schar)[2]; minday = dmin.split(schar)[0]; minmonth = dmin.split(schar)[1]; minyear = dmin.split(schar)[2]; maxday = dmax.split(schar)[0]; maxmonth = dmax.split(schar)[1]; maxyear = dmax.split(schar)[2]; break; case "mmddyyyy": day = date.split(schar)[1]; month = date.split(schar)[0]; year = date.split(schar)[2]; minday = dmin.split(schar)[1]; minmonth = dmin.split(schar)[0]; minyear = dmin.split(schar)[2]; maxday = dmax.split(schar)[1]; maxmonth = dmax.split(schar)[0]; maxyear = dmax.split(schar)[2]; break; case "yyyyddmm": day = date.split(schar)[2]; month = date.split(schar)[0]; year = date.split(schar)[1]; minday = dmin.split(schar)[2]; minmonth = dmin.split(schar)[0]; minyear = dmin.split(schar)[1]; maxday = dmax.split(schar)[2]; maxmonth = dmax.split(schar)[0]; maxyear = dmax.split(schar)[1]; break; default : return false;
    } if ((!(year>=minyear)) || (!(year=minmonth)) || (!(month=minday)) || (!(day<=maxday))) {
        return false;
    } return true;
}

function _TextInMin(str, min) { 
    if ((typeof(str)=='undefined') || (typeof(min)=='undefined')){
        return false;
    } if ((!(str.length = max))) {
        return false;
    } return true;
}

function _TextInMinMax(str, min, max) { 
    if ((typeof(str)=='undefined') || (typeof(min)=='undefined') || (typeof(max)=='undefined')){
        return false;
    } if ((!(str.length = max))) {
        return false;
    } return true;
}

function _IsEmail(str) { 
    if (typeof(str)=='undefined') {
        return false;
    } var expr1 = /^([a-zA-Z0-9_-.]+)@([a-zA-Z0-9_-.]+).([a-zA-Z]{2,5})$/; if (!expr1.test(str)){
        return false;
    } return true;
}

function _IsEmailList(str, schar) { 
    if (typeof(str)=='undefined') {
        return false;
    } if ((typeof(schar)=='undefined')){
        schar = ",";
    } var array = str.split(schar); for (var email in array) {
        if (!(_IsEmail(email))){
            return false;
        }
    } return true;
}

function _IsRFC(str) { 
    if ((typeof(schar)=='undefined')){
        return false;
    } var expr1 = /^[A-Za-z]{4}[ |-]{0,1}[0-9]{6}[ |-]{0,1}[0-9A-Za-z]{3}$/; if (!expr1.test(str)){
        return false;
    } return true;
}